import React, { Component } from 'react'

export default class Searchstu extends Component {
    constructor(props) {
        super(props);
        this.searchTypeVal = 'name';
    }
    searchContentRef = (ele) => {
        this.searchContentEle = ele;
    }
    handleSearch = () => {
        let {searchTypeVal,searchContentEle} = this
        this.props.searchStu(searchTypeVal,searchContentEle.value)
    }
    searchType = (e) => {
        this.searchTypeVal = e.target.value;
    }
    render() {
        return (
            <div>
                <p>
                    <select name="searchType" id="" onChange={this.searchType}>
                        <option value="name">姓名</option>
                        <option value="sex">性别</option>
                        <option value="age">年龄</option>
                    </select>
                    <input ref={this.searchContentRef} type="text" />
                    <button onClick={this.handleSearch}>搜索</button>
                </p>
            </div>
        )
    }

}
